/* 
*  Copyright (C) 2009-2010 WCG Project
*
*  This program is free software; you can redistribute it and/or modify it
*  under the terms of the GNU General Public License as published by the
*  Free Software Foundation; either version 2 of the License, or (at
*  your option) any later version.
*
*  This program is distributed in the hope that it will be useful, but
*  WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
*  General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software Foundation,
*  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*  In addition, as a special exception, the author gives permission to
*  link the code of this program with the Half-Life Game Engine ("HL
*  Engine") and Modified Game Libraries ("MODs") developed by Valve,
*  L.L.C ("Valve"). You must obey the GNU General Public License in all
*  respects for all of the code used other than the HL Engine and MODs
*  from Valve. If you modify this file, you may extend this exception
*  to your version of the file, but you are not obligated to do so. If
*  you do not wish to do so, delete this exception statement from your
*  version.
*/




new const g_MODclient[] = "* [WCG]"
new const MOTD_header[] = "<html><head><LINK REL=^"StyleSheet^" HREF=^"wcg.css^" TYPE=^"text/css^"></head><body>"

new const g_TeamNames[][] = { "UNASSIGNED", "TERRORIST", "CT", "SPECTATOR" }

new szTmpMsg[2048]		// Use this everywhere instead of declaring it in each function (compiles faster)



/*new const ClassAttributesBase[][MAX_ATTRIBUTES] = {
//		STR,	STA,	DEX,	AGI,	INT,	SPR
	{	0,		0,		0,		0,		0,		0	},		// CLASS_NONE
	{	0,		4,		0,		0,		0,		0	},		// CLASS_ROGUE
	{	0,		6,		0,		0,		0,		0	},		// CLASS_PALADIN
	{	0,		5,		0,		0,		0,		0	},		// CLASS_SHAMAN
	{	0,		4,		0,		0,		0,		0	},		// CLASS_DRUID
	{	0,		10,		0,		0,		0,		0	},		// CLASS_WARLOCK
	{	0,		4,		0,		0,		0,		0	},		// CLASS_HUNTER
	{	0,		9,		0,		0,		0,		0	},		// CLASS_PRIEST
	{	0,		2,		0,		0,		0,		0	}		// CLASS_MAGE
}
*/


// Remember that enum "variable" declarations are the same as
// defined labels, which makes them global.
// Functions can't declare local variables with the same name.
//
// Make damn sure you never go out of bounce on arrays!
// Actually, it would be safest not to store arrays in enum structs at all
//
// Note on Floats. For some reason the compiler will give a 
// tag mismatch when storing Float variables unless they're
// casted to cell (_:variable) first. Other way around works
// without problems though.
//
// Did I mention to make damn sure to never go out of bounce on arrays?
//
// S_PLAYERINFO contains all and everything regarding individual players
enum S_PLAYERINFO
{
	PI_PlayerName[33],						// Player's current name
	PI_PlayerOldName[33],					// Player's previous name

	PI_StartusBarRaceInfoText[64],			// string placeholder for players statusbar updates
	PI_StartusBarItemInfoText[64],			// string placeholder for players statusbar updates
	
	PI_StatusText[33],						// Name of the players latest lookat target
	PI_StatusTextColor,

	PI_CurrentWeapon,

	PI_XP,									// Current XP
	PI_Level,								// Player Level
	PI_Class,								// Class
	PI_TeamID,								// Stores the player's team ID
	PI_LastManaCost,						// Stores the cost of the last spell casted
	PI_RespawnBy,
	PI_ResurrectLevel,						// Level of the resurrectskill used when being resurrected
	PI_Rings,
	PI_SerpentCount,						// Number of serpent wards the player has placed
	PI_LastArmor,							// This will contain the previous value of P_ARMORONDEATH
	PI_ArmorOnDeath,						// Amount of armor the player had when he/she died
//	PI_SmokeCount,							// Number of smoke grenades bought that round
	PI_HECount,								// Number of HE's bought that round
	PI_FlashCount,							// Number of flash grenades bought that round
	PI_ChangeToRace,						// Holds the value of what race to change to when the following round starts
	PI_SpellCooldown[MAX_SKILLS],			// Cooldown counter for all spells
	PI_SearchSkillID,						// If PI_IsSearching is true, this will tell which skill the player is using
	PI_SearchTeamID,						// The player is searching for players on this team
	PI_SearchFlags,							// Casting flags used when starting the search spell
	PI_SearchTaskName[33],					// This is the task that the search spell will execute when conditions are met
	PI_Hitgroup,							// Hitgroup last traceline hit
	PI_LastHitByWeaponIndex,				// Index of last weapon that damaged the player
	PI_GlowLevel,							// The players current glow level (Packed int with RGB values)
	PI_SpectatingID,						// User id of the spectated player
	PI_PlayerRole,
	PI_SelectedUltimate,
	PI_SelectedAbility,
	PI_Stealthed,							// 0 if not stealthed, else the level of the stealth skill
	PI_Slowed,								// Set if the player is slowed
	PI_KnifeAttackType,						// When attacking with knife. 1 = Primary attack, 2 = Secondary attack

	PI_STR,									// These are cached values of the playerattributes
	PI_STA,									// Base values + bonuses for the selected class are pre-added into these.
	PI_DEX,									//
	PI_AGI,									//
	PI_INT,									//
	PI_SPR,									//

	PI_BaseHealth,							// Starting health without buffs
	PI_Mana,								// The current amount of mana the player have, this is a copy of the float value
	PI_MaxMana,								// The maximum amount of mana the player can have
	Float:PI_fMana,							// The current amount of mana the player have

	Float:PI_AttackModifier,				// 1/((Level*2+Str*4+Agi*2)*0.002)  Damage calc: Dmg+Dmg/PI_AttackModifier

	CsArmorType:PI_ArmorType,

	Float:PI_Speed,							// Current player speed. (130 = Walking, 250 = Running)

	bool:PI_CastingSpell,					// Set to true is user has started casting any spell
	bool:PI_CastingInterrupted,				// Set to true when a spellcast is interrupted
	bool:PI_SkinSwitched,					// Set if the user's skin has been changed
	bool:PI_ResetSkills,					// Does the player want to reset their skills in the next round?
	bool:PI_ResetAttributes,				// Does the player want to reset their attributes in the next round?
	bool:PI_ChangingTeam,					// Is the user currently changing his/her team?
	bool:PI_DiedLastRound,					// Did the user died during the previous round?
	bool:PI_KillAllWards,
	bool:PI_Defuse,							// Player had a defuse kit when he/she died?
	bool:PI_Shield,							// Player had a shield when he/she died?
	bool:PI_Nightvision,					// Player had nightvision when he/she died?
	bool:PI_USP_Silenced,					// USP silenced on death?
	bool:PI_M4A1_Silenced,					// M4A1 silenced on death?
	bool:PI_GlockBurst,						// Glock in burst mode on death?
	bool:PI_FamasBurst,						// Famas in burst mode on death?
	bool:PI_GiveItems,						// Tells weapon controller function to give the player his items after respawning
	bool:PI_HasSpawned,						// Has the player previously spawned this round?
	bool:PI_CanRender,
	bool:PI_IsZoomed,						// True if players view is zoomed
	bool:PI_IsOnGround,						// True if the player is touching the ground.
	bool:PI_IsCheatDeathActive,				// True if cheat death is active on the player
	bool:PI_IsInvisible,
	bool:PI_IsBurning,						// Is the player burning from the immolate ultimate?
	bool:PI_IsStunned,						// True if the player is stunned
	bool:PI_IsSearching,					// True if players ultimate with "search"-function is active
	bool:PI_IsPlantingDefusing,				// Set to true if the user is planting or defusing the bomb
	bool:PI_IsImmobilized,
	bool:PI_IsPolymorphed,
	bool:PI_IsFlashed,
	bool:PI_HasBegunPlantingOrDefusing,		// Used to keep track of xp given when player starts defuse/plant
	bool:PI_HadAnkh							// Used when players are resurrected
}
new PlayerInfo[33][S_PLAYERINFO]


// This is cleared every time a player spawns
enum S_PLAYERBUFFINFO
{
	BUFF_Fortitude,							// Buffed with fortitude hp
	BUFF_DevotionAura,
	BUFF_BoK,
	
	bool:BUFF_DivineProtection,
	bool:BUFF_BeastWithin
}
new PlayerBuffInfo[33][S_PLAYERBUFFINFO]




new g_iDamageDealt[33][33]					// Used to keep track of how much dmg one player does to another
new g_iHealingDone[33][33]					// Used to keep track of how much healing one player does to another
new bool:bIgnoreArmorSet[33]
new g_PlayerWeapons[33][32]					// Stores player weapons after they have been purchased
new g_PlayerLastWeapons[33][32]				// Stores player weapons after they have been purchased
new bool:g_bLevitation[33]
new Float:g_fLastSpecDisplay[33]





enum S_GAMEINFO
{
	GI_ModName[32],

	GI_MaxPlayers,							// Number of player slots the server have
	GI_Mod,
	GI_Heartbeat,							// Heartbeat counter, increases by 1 each time the heartbeat function is called
	GI_SerpentCount,						// Total amount of active serpentwards placed on the map

	bool:GI_EndRound,
	bool:GI_FreezeTime,
	bool:GI_BuyTime,
	bool:GI_GameRestarting,
	bool:GI_DisableEnhGrenades,
	bool:GI_GlovesDisabled,
	bool:GI_BombPlanted,					// True if the bomb is planted, else false
	Float:GI_BombOrigin[3]					// Origin of bomb model when planted
}
new GameInfo[S_GAMEINFO]

new g_NumTeamPlayers[4]
new g_SortedTeams[4][33]

new g_HUDSync_StatusText
new gmsgDeathMsg
new gmsgScreenFade
new gmsgScreenShake
new gmsgScoreInfo
new gmsgStatusIcon
new gmsgSayText
new gmsgTextMsg
new gmsgStatusText
new gmsgBarTime

new xplevel_lev[MAX_LEVELS+1]		// Table of XP needed to achieve each level
new xpgiven_lev[MAX_LEVELS+1]		// Table of XP given at each level

new g_szSounds[MAX_SOUNDS][64]

// sprites
new g_spr_nhth1
new g_spr_animglow01
new g_spr_explode1
new g_spr_xfire
new g_spr_stmbal1
new g_spr_smoke
new g_spr_shockwave
new g_spr_lgtning
new g_spr_blueflare2
new g_spr_fireball
new g_spr_zbeam1
new g_spr_xspark2
//new g_spr_test

new g_SkillOwner[MAX_SKILLS]					// For each skill, says who the owning race is
new g_SkillType[MAX_SKILLS]					// For each skill, says what type of skill it is (trainable/ultimate/passive)
new g_SkillMaxLevel[MAX_SKILLS]				// Number of levels the skill has
new g_SkillLevelReq[MAX_SKILLS]				// Player level required to select skill
new g_SkillReq[MAX_SKILLS]					// Required skill to select this skill
new g_SkillCooldown[MAX_SKILLS]				// Cooldown value for each skill

new g_PlayerSkillLevel[33][MAX_SKILLS]			// Stores what level each skill is

new g_NumAvailableSkills[33]
new g_AvailableSkills[33][MAX_SKILLS]			// Stores what skills the player has available (set on race selection)

new g_PlayerAttributeLevel[33][MAX_ATTRIBUTES]		// Stores what level each skill is


// Item Variables
new g_iShopMenuItems[33][MAX_PLAYER_ITEMS];			// Holds the player's current items
new g_iFutureItem[33];                              // Holds the item that the player wants to buy 

new g_iTotalRings[33];								// Holds the number of rings the player has
new g_iHelmCharges[33];								// Holds the number of charges left in the player's helm

new bool:g_bPlayerBoughtAnkh[33];					// Set to true when a user buys an ankh

new g_iGloveTimer[33];								// Keeps track of how much time is left to give a user a grenade

new ITEM_COST[MAX_SHOPMENU_ITEMS];                  // Holds the price of an item

new g_iFlag[MAX_SHOPMENU_ITEMS] = {0};			// Stores information about items


